package com.huawei.gamebox.plugin.realnameauth;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import com.huawei.gamebox.plugin.gameservice.bean.RealNameParam;
import java.io.Serializable;
import o.ayw;
import o.Logger;
import o.fab;
import o.fao;
import o.fav;
import org.json.JSONObject;

public class RealNameAuthActivity extends Activity {
    private static fav ॱ;
    private fao ˎ;

    public static void ˎ(Context context, GameInfo gameInfo, RealNameParam realNameParam, fav o_fav, boolean z) {
        if (Logger.ˎ()) {
            Logger.ˏ("RealNameAuthActivity", "start to open RealNameAuthActivity, isSupportRemoteOpenActivity:" + z);
        }
        ॱ = o_fav;
        if (context != null) {
            Intent intent = new Intent();
            intent.setClass(context, RealNameAuthActivity.class);
            Bundle bundle = new Bundle();
            if (realNameParam != null) {
                try {
                    bundle.putString("REAL_NAME_PARAM", realNameParam.toJson());
                } catch (Exception e) {
                    Logger.e("RealNameAuthActivity", "RealNameParam toJson exception");
                }
            }
            if (gameInfo != null) {
                bundle.putSerializable("GAME_INFO", gameInfo);
            }
            intent.putExtras(bundle);
            if (z) {
                fab.ˎ().ˋ(gameInfo, RealNameAuthActivity.class, intent, null);
                return;
            }
            if (!(context instanceof Activity)) {
                intent.addFlags(268435456);
            }
            context.startActivity(intent);
        }
    }

    protected void onCreate(Bundle bundle) {
        GameInfo gameInfo;
        super.onCreate(bundle);
        requestWindowFeature(1);
        ayw.ॱ(this);
        View view = new View(this);
        view.setAlpha(0.0f);
        setContentView(view);
        String stringExtra = getIntent().getStringExtra("REAL_NAME_PARAM");
        RealNameParam realNameParam = new RealNameParam();
        try {
            realNameParam.fromJson(new JSONObject(stringExtra));
        } catch (Exception e) {
            Logger.e("RealNameAuthActivity", "RealNameParam froJson exception");
        }
        Serializable serializableExtra = getIntent().getSerializableExtra("GAME_INFO");
        if (serializableExtra instanceof GameInfo) {
            gameInfo = (GameInfo) serializableExtra;
        } else {
            gameInfo = new GameInfo();
        }
        this.ˎ = fao.ˊ(this, gameInfo, realNameParam, ॱ);
        if (this.ˎ == null) {
            finish();
            if (ॱ != null) {
                ॱ.ˋ(2);
                return;
            }
            return;
        }
        this.ˎ.ॱ();
    }

    protected void onDestroy() {
        super.onDestroy();
        if (this.ˎ != null) {
            this.ˎ.ˎ(null);
            this.ˎ.ˏ();
        }
    }
}
